package com.polimi.meteocal.business.entity;

import java.io.Serializable;

import javax.persistence.*;


/**
 * The persistent class for the notification database table.
 * 
 */
@Entity
@NamedQueries({
@NamedQuery(name="Notification.findAll", query="SELECT n FROM Notification n"),

@NamedQuery(name="Notification.getNotifications", query="SELECT n FROM Notification n "
										+ "WHERE n.id.usersEmail= :user AND "
										+ "n.isREAD=false")
})
public class Notification implements Serializable {
	private static final long serialVersionUID = 1L;
	public static final String GET_NOTIFICATIONS = "Notification.getNotifications";

	@EmbeddedId
	private NotificationPK id;

	@Column(name="`CONDITION`")
	private String condition;

	private boolean isREAD;

	//bi-directional many-to-one association to Event
	@ManyToOne
	private Event event;

	//bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name="USERS_EMAIL")
	private User user;

	public Notification() {
	}

	public NotificationPK getId() {
		return this.id;
	}

	public void setId(NotificationPK id) {
		this.id = id;
	}

	public String getCondition() {
		return this.condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	public boolean getIsREAD() {
		return this.isREAD;
	}

	public void setIsREAD(boolean isREAD) {
		this.isREAD = isREAD;
	}

	public Event getEvent() {
		return this.event;
	}

	public void setEvent(Event event) {
		this.event = event;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}